package com.nbsaas.boot.customer.rest.resource;

import com.nbsaas.boot.customer.api.apis.CustomerLabelApi;
import com.nbsaas.boot.customer.data.entity.CustomerLabel;
import com.nbsaas.boot.customer.api.domain.request.CustomerLabelRequest;
import com.nbsaas.boot.customer.api.domain.response.CustomerLabelResponse;
import com.nbsaas.boot.customer.api.domain.simple.CustomerLabelSimple;
import com.nbsaas.boot.customer.rest.convert.CustomerLabelSimpleConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerLabelEntityConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerLabelResponseConvert;
import com.nbsaas.boot.customer.data.repository.CustomerLabelRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   客户标签-业务接口实现
*/
@Transactional
@Service
public class CustomerLabelResource extends BaseResource<CustomerLabel,CustomerLabelResponse, CustomerLabelSimple, CustomerLabelRequest>  implements CustomerLabelApi {

    @Resource
    private CustomerLabelRepository customerLabelRepository;

    @Override
    public JpaRepositoryImplementation<CustomerLabel, Serializable> getJpaRepository() {
        return customerLabelRepository;
    }

    @Override
    public Function<CustomerLabel, CustomerLabelSimple> getConvertSimple() {
        return new CustomerLabelSimpleConvert();
    }

    @Override
    public Function<CustomerLabelRequest, CustomerLabel> getConvertForm() {
        return new CustomerLabelEntityConvert();
    }

    @Override
    public Function<CustomerLabel, CustomerLabelResponse> getConvertResponse() {
        return new CustomerLabelResponseConvert();
    }




}


